extends Panel


func _ready():
	$ActionHbox/OkButton.connect("pressed",$"/root/Global","add_each_week_to_list")
	$ActionHbox/OkButton.connect("pressed",self,"do_action")
	pass

func _on_CancelButton_pressed():
	self.hide()
	pass
	
func do_action():
	var cost = 0
	if not Global.week_anpai.has(null):
		for action in Global.week_anpai:
			if action == "reset" or action == "work":
				pass
			else:
				cost += 12 
		if Global.data["coin"] >= cost:
			Global.data["coin"] -= cost
			get_tree().change_scene("res://scene/AnPai.tscn")
		else:
			get_tree().current_scene.get_node("CoinNotEnoughPopup").popup()
			pass
